 
<div class="block">
    <h4 class="vatlytrilieu"><a href="<?=$this->baseUrl("/")?>" >Home </a>&gt; Cart</h4>
    <div class="block_content">
          <div class="table cart">
            <table id="table-5">
                <thead>
                    <tr>
                        <th>Item Code</th>
                        <th class="center">Product Name</th>
                        <th class="center">Price</th>
                        <th class="center">Quantity</th>
                        <th class="center">Total Price</th>
                        <th class="center"></th>
                    </tr>
                </thead>
                
                <tbody>
                   <?php $sum=0; foreach($this->cart->items as $row){ $sum+=$row['qty']*$row['prod']->price?>
                   <tr>
                        <td><?=$row['prod']->code?></td>
                        <td><?=$row['prod']->name?></td>
                        <td>$<?=number_format($row['prod']->price,"2",".","")?></td>
                        <td style="text-align: center;"><input rel="<?=$row['prod']->id?>" class="up-qty" type="text" value="<?=$row['qty']?>" name="qty" class="qty-prod" size="3" style="height: 20px; text-align: center;" /></td>
                        <td>$<?=number_format(($row['prod']->price*$row['qty']),2,".","")?></td>
                        <td><a class="del-item" href="<?=$this->baseUrl($this->url(array("module"=>"default","controller"=>"cart","action"=>"del","id"=>$row['prod']->id)))?>">[Xóa]</a></td>
                   </tr>
                   <?php }?>                     
                </tbody>
                
                <tfoot>
                    <tr>
                        <td colspan="3" style="font-size:17px">Sum</td>
                        <td colspan="2" style="text-align: center;" id="sum">$<?=number_format($sum,2,".","")?></td>
                        <td></td>
                    </tr>
                </tfoot>
            </table>
            
        </div>
    </div>
    <div class="k-button" style="text-align: right; padding-right: 10px;">
        <a href="<?=$this->baseUrl("/")?>" class="shop-more"></a>
        <a href="<?=$this->url(array("module"=>"default","controller"=>"cart","action"=>"checkout"))?>" class="checkout"></a>        
        <a class="paypal" href="#">&nbsp;</a>
    </div>
</div>

<script>
$(function(){
    $(".del-item").click(function(){
        var clickObj = $(this);
        var link = $(this).attr("href");
       $.get(link,null, function(rdata){
            $(".giohang").text("Cart: " + rdata.total + " item");
            clickObj.parent("td").parent("tr").remove();
            $("#sum").text(rdata.sum);
       },"json")
       return false; 
    });
    
    $(".up-qty").change(function(){
        var _this = $(this);
        var value = $(this).val();
        var link = "<?=$this->url(array("module"=>"default","cotroller"=>"cart","action"=>"edit"))?>/id/"+_this.attr("rel")+"/qty/" + value;
        $.get(link,null,function(rdata){
            $(".giohang a").html(rdata.total+" item");
            _this.parent("td").next("td").text(rdata.total_price);
            $("#sum").html(rdata.sum);
        },"json");
    })
    
})
</script>
